import pymysql,Config

class DBMysql():
    def __init__(self):
        self.conn = pymysql.connect(host=Config.SERVER,port=Config.MYSQL_PORT,user=Config.MYSQL_USER,\
                                    password=Config.MYSQL_PWD,database=Config.MYSQL_DB)
        self.cursor = self.conn.cursor()

    def QueryDB(self,sql=None):

        self.cursor.execute(sql)
        res = self.cursor.fetchall()
        return res

    def CloseDB(self):
        self.cursor.close()
        self.conn.close()

db_Mysql = DBMysql()



